package licode.unisop.types.dp;

import org.springframework.util.Assert;

public class PlatformUserState {

    public static final PlatformUserState OK = new PlatformUserState(0);
    public static final PlatformUserState STOPPED = new PlatformUserState(1);
    public static final PlatformUserState DELETED = new PlatformUserState(2);

    private final int state;

    private PlatformUserState(int state) {
        this.state = state;
    }

    public static PlatformUserState build(int state) {

        if (OK.state == state) {
            return OK;
        } else if (STOPPED.state == state) {
            return STOPPED;
        } else if (DELETED.state == state) {
            return DELETED;
        }

        Assert.isTrue(false, "非法的平台用户状态：" + state);

        return new PlatformUserState(state);
    }

    public boolean isOk() {
        return OK.state == state;
    }

    public boolean isStopped() {
        return STOPPED.state == state;
    }

    public boolean isDeleted() {
        return DELETED.state == state;
    }

    public int getState() {
        return state;
    }
}
